﻿
(function () {
    appModule.controller('common.views.callPolices.handleSuggestion', [
         '$scope', '$uibModalInstance', 'abp.services.app.callPolice', 'callPoliceId', 'abp.services.app.callType',
        function ($scope, $uibModalInstance, callPoliceService, callPoliceId, callTypeService) {
            var vm = this;
            vm.saving = false;
            //首先将callPolice数据设置为null
            vm.callPolice = null;
            vm.showFile = false;
            vm.showDetail = false;

            //触发保存方法
            vm.save = function () {
                vm.saving = true;
                vm.callPolice.processContent = '填写处理意见,受理当前报警.';
                callPoliceService.createOrUpdateCallPoliceAsync({ callPoliceEditDto: vm.callPolice }).then(function () {
                    abp.notify.info(app.localize('SavedSuccessfully'));
                    $uibModalInstance.close();
                }).finally(function () {
                    vm.saving = false;
                });


            };
            //取消关闭页面
            vm.cancel = function () {
                $uibModalInstance.dismiss();
            };

            //初始化页面
            function init() {

                callPoliceService.getCallPoliceForEditAsync({
                    id: callPoliceId
                }).then(function (result) {
                    vm.callPolice = result.data.callPolice;
                });

            }
            //执行初始化方法
            init();
        }
    ]);
})();